<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>我是a页面</h1>
    <button>点击跳转b</button>
    <button>点击前进到下一个历史记录</button>
    <button>点击进入到c页面</button>
    <script>
      var butEle = document.querySelector("button");
      butEle.onclick = function () {
        window.location.href = "b.html";
      };
      var butEle1 = document.querySelectorAll("button")[1];
      butEle1.onclick = function () {
        window.history.forward();
      };
      var butEle2 = document.querySelectorAll("button")[2];
      butEle2.onclick = function () {
        window.history.go(2);
      };
    </script>
  </body>
</html>
